Public Class TransFormClass
    Inherits ZPixel.Form

    WithEvents textb As TextBox
    WithEvents pic As PictureBox
    WithEvents list As ListView
    WithEvents popups As ToolTip

    Public Sub New()
        pic = New PictureBox
        pic.BackColor = Color.Transparent
        pic.Image = My.Resources.button
        pic.SizeMode = PictureBoxSizeMode.AutoSize
        Me.Controls.Add(pic)

        popups = New ToolTip()
        popups.SetToolTip(pic, "Hello, world!")

        list = New ListView
        list.CausesValidation = True
        list.Items.Add("Hello")
        list.Items.Add("Boo!")
        list.Location = New Point(100, 100)
        list.Size = New Size(300, 300)
        Me.Controls.Add(list)

        Me.Image = New MyPixelBitmapFilter().ApplyFilter(My.Resources.back)
        Me.Text = "Boo to you!"
        Me.AutoUpdate = True

        'textb = New TextBox
        'textb.Text = "Coolio"
        'textb.Location = New Point(150, 200)
        'Me.Controls.Add(textb)

        Me.Location = New Point((Screen.FromPoint(Me.PointToScreen(New Point(0, 0))).Bounds.Width / 2) - (Me.Width / 2), (Screen.FromPoint(Me.PointToScreen(New Point(0, 0))).Bounds.Height / 2) - (Me.Height / 2))

        'Me.ShowInTaskbar = False
        Me.TopMost = True
        Me.Refresh()
        Me.StartFade(500)
    End Sub

    Private Sub TransFormClass_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
        Refresh()
    End Sub

    Private Sub TransFormClass_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
        e.Graphics.FillEllipse(Brushes.Lime, New Rectangle(100, 100, 200, 200))
        e.Graphics.FillEllipse(Brushes.Orange, New Rectangle(150, 150, 100, 100))
    End Sub

    Private Sub list_Invalidated(ByVal sender As Object, ByVal e As System.Windows.Forms.InvalidateEventArgs) Handles list.Invalidated
        Debug.Print("Boom!")
        Refresh()
    End Sub

    Private Sub list_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles list.Validated
        Debug.Print("Boom!")
        Refresh()
    End Sub

    Public Class MyPixelBitmapFilter
        Inherits ZPixel.PixelBitmapFilter

        Protected Overrides Sub ApplyFilterLogic()
            For y As Integer = 0 To ImageHeight - 1
                For x As Integer = 0 To ImageWidth - 1
                    Dim c As Color = GetPixel(x, y)
                    Dim newValue As Integer = (CInt(c.R) + CInt(c.G) + CInt(c.B)) / 3
                    SetPixel(x, y, Color.FromArgb(c.A, newValue, newValue, newValue))
                Next
            Next
        End Sub

    End Class


End Class